
"""
is only needed to make a choice of
encryption through a config file
"""

from Config import Config
import Cipher



config = Config()

class ChoiceCipher(Cipher._OFile):
    def ENCRYPT(self, data: bytes) -> bytes:
        if config.GET_CIPHER() == "GPG" or not config.GET_CIPHER():
            gpg = Cipher.GPG(config.GET_GPG_ID())
            
            return gpg.ENCRYPT(data)
            
        elif config.GET_CIPHER() == "GPG_SYM" or config.GET_CIPHER() == "AES256":
            gpg = Cipher.GPG_SYM()
            
            return gpg.ENCRYPT(data)

    def DECRYPT(self, data: bytes) -> bytes:
        if config.GET_CIPHER() == "GPG" or not config.GET_CIPHER():
            gpg = Cipher.GPG(config.GET_GPG_ID())
            
            return gpg.DECRYPT(data)
            
        elif config.GET_CIPHER() == "GPG_SYM" or config.GET_CIPHER() == "AES256":
            gpg = Cipher.GPG_SYM()
            
            return gpg.DECRYPT(data)

